package week1;

import jdk.nashorn.internal.runtime.FindProperty;

import java.util.Scanner;

public class T7 {
    public static void main(String[] args) {
        System.out.print("str=");

        Scanner scanner=new Scanner(System.in);
        String input=scanner.nextLine();
        String input1=input.substring(1,input.length()-1);
        String[] str=input1.split(",");

        Find(str);

    }


    public static void Find(String[] str ){
        StringBuilder result=new StringBuilder();

        //find shortest
        int shortest=str[0].length();
        for (int i=0;i<str.length;i++){
            if(str[i].length()<shortest){
                shortest=str[i].length();
            }
        }

        for (int i=0;i<shortest;i++){
            for (int j=0;j<str.length-1;j++){
                if(str[j].charAt(i)!=str[j+1].charAt(i)){
                    String res=result.toString();
                    if (res.length()==1){
                        System.out.println(res+'"');
                    }
                    else {
                        if (res.charAt(res.length()-1)=='"'){
                            System.out.println(res);
                        }
                        else {
                            System.out.println(res+'"');
                        }
                    }
                    return;
                }
                if (j==str.length-2&&str[j].charAt(i)==str[j+1].charAt(i)){
                    result.append(str[j].charAt(i));
                }
            }
        }

    }

}
